package com.wyp.didishige.utils;

import android.graphics.Bitmap;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.wyp.didishige.R;

/**
 * UIL - 工具
 *
 * @author JackLiu
 */
public final class ImageLoaderUtil {
    // ImageLoader
    public static final ImageLoader ImageLoaderInstance = ImageLoader
            .getInstance();

    // 头像缩略图（含有默认图片）
    public static final DisplayImageOptions Thumbnail_Portrait_Round_Options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_launcher)
            .showImageForEmptyUri(R.drawable.ic_launcher)
            .showImageOnFail(R.drawable.ic_launcher)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .displayer(new RoundedBitmapDisplayer(8))
            .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
            .bitmapConfig(Bitmap.Config.RGB_565).build();

    // 头像缩略图（含有默认图片）
    public static final DisplayImageOptions Thumbnail_Portrait_Options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.ic_launcher)
            .showImageForEmptyUri(R.drawable.ic_launcher)
            .showImageOnFail(R.drawable.ic_launcher)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
            .bitmapConfig(Bitmap.Config.RGB_565).build();

    // 图片缩略图（含有默认图片）
    public static final DisplayImageOptions Thumbnail_Image_Options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.img_def)
            .showImageForEmptyUri(R.drawable.img_def)
            .showImageOnFail(R.drawable.img_def)
            .cacheInMemory(true)
            .cacheOnDisc(true).considerExifParams(true)
            .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
            .bitmapConfig(Bitmap.Config.RGB_565).build();

    // 图片缩略图（无默认图片）
    public static final DisplayImageOptions Thumbnail_Image_NonDef_Options = new DisplayImageOptions.Builder()
            .cacheInMemory(true).cacheOnDisc(true).considerExifParams(true)
            .imageScaleType(ImageScaleType.IN_SAMPLE_INT)
            .bitmapConfig(Bitmap.Config.RGB_565).build();

    // 图片（无默认图片）
    public static final DisplayImageOptions Image_NonDef_Options = new DisplayImageOptions.Builder()
            .cacheOnDisc(true).considerExifParams(true)
            .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
            .bitmapConfig(Bitmap.Config.RGB_565).build();

    // 图片（含默认图片）
    public static final DisplayImageOptions Image_Options = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.img_def)
            .showImageForEmptyUri(R.drawable.img_def)
            .showImageOnFail(R.drawable.img_def)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    // 图片（含默认图片）
    public static final DisplayImageOptions Image_Options_USER_BG = new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.user_bg_11)
            .showImageForEmptyUri(R.drawable.user_bg_11)
            .showImageOnFail(R.drawable.img_def)
            .cacheOnDisc(true)
            .considerExifParams(true)
            .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();
    // 分页图片
    public static final DisplayImageOptions Image_Pager_Options = new DisplayImageOptions.Builder()
            .resetViewBeforeLoading(true)
            .cacheOnDisc(true)
            .imageScaleType(ImageScaleType.EXACTLY)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .considerExifParams(true)
                    //.displayer(new FadeInBitmapDisplayer(300))
            .build();
}
